package com.duoec.dw.lineage.service.analyser;

import com.alibaba.druid.sql.ast.SQLExpr;
import com.duoec.dw.lineage.dto.MultiTableLineageDto;
import com.duoec.dw.lineage.dto.TableFieldLineageDto;
import com.duoec.dw.lineage.dto.TableLineageDto;

import java.util.LinkedHashSet;

/**
 * @author xuwenzhen
 */
public interface HiveSelectFieldAnalyser<T extends SQLExpr> {
    /**
     * 当前类处理的类型
     *
     * @return SQLExpr的子类
     */
    Class<T> getSelectFieldType();

    /**
     * 解析 select
     *
     * @param selectFieldExpr   需要解析的select field
     * @param tableLineage      当前表的血缘关系信息
     * @param fromTableLineages 当前查询依赖字段的多表血缘关系
     */
    LinkedHashSet<TableFieldLineageDto> analyse(T selectFieldExpr, TableLineageDto tableLineage, MultiTableLineageDto fromTableLineages);
}
